<?php $this->start('admin_menu')?>
	<?php echo $this->element('admin_menu', array('str_item' => 'galleries')) ?>
<?php $this->end(); ?>

<div class="galleries view">
<h2><?php echo $gallery['Gallery']['name']; ?></h2>
	<div class='gallery-form'>
		<?php 	echo $this->Session->flash();
		echo $this->Session->flash('good');
		echo $this->Session->flash('bad'); ?>
		<?php echo $this->Form->create('Gallery', array('action' => 'add_image', 'type' => 'file')); ?>
			<?php echo $this->Form->input('id', array('value' => $gallery['Gallery']['id'])); ?>
			<label> Upload image: </label>
			<?php
			    echo $this->Form->input('Image.0.photo', array('label' => false, 'type' => 'file', 'class' => 'required', 'div' => false));
          echo $this->Form->input('Image.0.dir', array('type' => 'hidden'));
          echo $this->Form->input('Image.0.mimetype', array('type' => 'hidden'));
          echo $this->Form->input('Image.0.filesize', array('type' => 'hidden'));
          echo $this->Form->input('Image.0.owner_model', array('type' => 'hidden', 'default' => 'Gallery'))
			?>
			<input type="submit" value="Upload" />
		<?php echo $this->Form->end(); ?>
	</div>
	<div style="clear:both;">
	<?php foreach($gallery['Image'] as $img): ?>
		<div class='gallery-div gallery-div-img'>
			<?php echo $this->Images->showSmall($img); ?>
			<?php echo $this->Form->postLink(__(''), array('action' => 'delete_img', $gallery['Gallery']['id'], $img['id']), array('class' => 'gallery-icon-del'), __('Are you sure you want to delete # %s?', $img['id'])); ?>
		</div>
	<?php endforeach; ?>
	</div>
</div>
<div class='actionct'>
    <span class='btn-act'><span><?php echo $this->Html->link(__('Back'), array('action' => 'index'), array('class' => 'back-act')); ?></span></span>
</div>


<?php $this->start('script') ?>
<script type="text/javascript">
  jQuery(document).ready(function(){
			jQuery('.gallery-div-img').mouseover(function(){
				jQuery(this).find(".gallery-icon-del").show();
			});

			jQuery('.gallery-div-img').mouseout(function(){
				jQuery(this).find(".gallery-icon-del").hide();
			});
  });
</script>
<?php $this->end() ?>
